package com.itheima.travel.controller;

import com.github.pagehelper.PageInfo;
import com.itheima.travel.domain.Route;
import com.itheima.travel.service.RouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/route")
public class RouteController {
    @Autowired
    private RouteService routeService;

    @RequestMapping("/findByPageByCid")
    public PageInfo findByPageByCid(Integer cid,
                                    @RequestParam(defaultValue = "1") Integer pageNum,
                                    String rname) {

        return routeService.findByPageByCid(cid, pageNum, rname);

    }

    @RequestMapping("/findRouteByRid")
    public Route findRouteByRid(Integer rid) {
        Route route = routeService.findRouteByRid(rid);
        return route;

    }


}
